<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">


<!--管理面板通用head-->
<header th:fragment="head">
    <meta charset="utf-8" />
    <link rel="apple-touch-icon" sizes="76x76" href="../assets/img/apple-icon.png">
    <link rel="icon" type="image/png" href="../assets/img/favicon.png">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no' name='viewport' />
    <!--字体和图标文件-->
    <link th:href="@{/assets/fonts/fonts.css}" rel="stylesheet" />
    <link th:href="@{/assets/css/all.css}" rel="stylesheet">
    <!--CSS文件-->
    <link th:href="@{/assets/css/bootstrap.css}" rel="stylesheet" />
    <link th:href="@{/assets/css/bootstrap-grid.css}" rel="stylesheet" />
    <link th:href="@{/assets/css/now-ui-dashboard.css?v=1.0.1}" rel="stylesheet" />
    <!-- CSS Just for demo purpose, don't include it in your project -->
    <link th:href="@{/assets/demo/demo.css}" rel="stylesheet" />
</header>

<!--侧边栏-->
<div class="sidebar" th:data-color="${session.loginUser.getStaffGrade()==1?'blue':'orange'}" th:fragment="sidebar">
    <!--Tip 1:可以修改侧边栏的颜色，通过设置:data-color="blue | green | orange | red | yellow"-->
    <div class="logo">
        <a th:href="@{/toDashBoard}" class="simple-text logo-normal" style="font-size: 25px;text-align: center" th:text="${session.loginUser.getStaffGrade()==1?'病房管理系统:管理员':'病房管理系统'}">
            病房管理系统
        </a>
    </div>
    <div class="sidebar-wrapper">
        <ul class="nav">
            <li th:class="${active=='dashboard.html'?'active':''}">
                <a th:href="@{/toDashBoard}">
                    <i class="now-ui-icons media-2_sound-wave"></i>
                    <p>首 页</p>
                </a>
            </li>
            <li th:class="${active=='patient_checkin.html'?'active':''}">
                <a th:href="@{/toPatientCheckin}">
                    <i class="now-ui-icons users_single-02"></i>
                    <p>病人登记</p>
                </a>
            </li>
            <li th:class="${active=='patient_list.html'?'active':''}">
                <a th:href="@{/toPatientList}">
                    <i class="now-ui-icons text_align-center"></i>
                    <p>病人管理</p>
                </a>
            </li>
            <li th:class="${active=='inpatientward_list.html'?'active':''}">
                <a th:href="@{/toInpatientwardList}">
                    <i class="now-ui-icons business_bank"></i>
                    <p>病房管理</p>
                </a>
            </li>
            <li th:class="${active=='doctor_list.html'?'active':''}">
                <a th:href="@{/toDoctorList}">
                    <i class="now-ui-icons business_badge"></i>
                    <p>医生管理</p>
                </a>
            </li>
            <li th:class="${active=='department_list.html'?'active':''}">
                <a th:href="@{/toDepartmentList}">
                    <i class="now-ui-icons ui-1_calendar-60"></i>
                    <p>科室管理</p>
                </a>
            </li>

            <li th:class="${active=='drug_list.html'?'active':''}">
                <a th:href="@{/toDrugList}">
                    <i class="now-ui-icons education_atom"></i>
                    <p>药品管理</p>
                </a>
            </li>

            <li th:class="${active=='log_list.html'?'active':''}">
                <a th:href="@{/toLogList}" disabled="">
                    <i class="now-ui-icons design_bullet-list-67"></i>
                    <p>出入院记录</p>
                </a>
            </li>

            <li th:class="${active=='patient_checkout.html'?'active active-pro':'active-pro'}">
                <a th:href="@{/toPatientCheckout}">
                    <i class="now-ui-icons health_ambulance"></i>
                    <p>出院办理</p>
                </a>
            </li>
        </ul>
    </div>
</div>

<!--navbar导航栏-->
<nav class="navbar navbar-expand-lg navbar-transparent  navbar-absolute bg-primary fixed-top" th:fragment="navbar">
    <div class="container-fluid">
        <div class="navbar-wrapper">
            <div class="navbar-toggle">
                <button type="button" class="navbar-toggler">
                    <span class="navbar-toggler-bar bar1"></span>
                    <span class="navbar-toggler-bar bar2"></span>
                    <span class="navbar-toggler-bar bar3"></span>
                </button>
            </div>
        </div>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navigation" aria-controls="navigation-index" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-bar navbar-kebab"></span>
            <span class="navbar-toggler-bar navbar-kebab"></span>
            <span class="navbar-toggler-bar navbar-kebab"></span>
        </button>
        <div class="collapse navbar-collapse justify-content-end" id="navigation">
            <form id="searchInpatientWard_form">
                <div class="input-group no-border">
                    <input type="number" name="id" id="search_id" class="form-control" placeholder="搜索病房..." required>
                    <span class="input-group-addon">
                    <i class="now-ui-icons ui-1_zoom-bold" onclick="search()"></i>
                    </span>
                </div>
            </form>
            <ul class="navbar-nav">
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        <i class="now-ui-icons users_single-02"></i>
                    </a>
                    <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink">
                        <a class="dropdown-item text-primary text-center" th:href="@{/toStaffInfo}">个人信息</a>
                        <button class="dropdown-item text-primary text-center" data-toggle="modal" data-target="#updatePasswordModal">修改密码</button>
                        <a class="dropdown-item text-primary text-center" th:if="${session.loginUser.getStaffGrade()==1}" th:href="@{/toAddStaff}">添加员工</a>
                        <a class="dropdown-item text-primary text-center" th:if="${session.loginUser.getStaffGrade()==1}" th:href="@{/toStaffList}">账号管理</a>
                        <a class="dropdown-item text-primary text-center" th:href="@{/logout}">退出系统</a>
                    </div>
                </li>
            </ul>
        </div>
    </div>

    <script>
        function search(){
            var id = document.getElementById('search_id').value;
            $.ajax({
                sync:false,
                url: '/inpatientward/search',
                data: {
                    'id': id
                },
                method:'get',
                dataType:'text',
                success:function(result){
                    if(result==='success'){
                        window.location = '/queryBedInfoByInpatientWardId/'+id;
                        return;
                    }
                    demo.showNotification('danger',result);
                }
            })
        }
    </script>
</nav>



<!--通用底部JS引用-->
<div th:fragment="footerJs">
    <script th:src="@{/assets/js/jquery-3.5.1.js}"></script>
    <!--   Core JS Files   -->
    <script th:src="@{/assets/js/core/popper.min.js}"></script>
    <script th:src="@{/assets/js/core/bootstrap.min.js}"></script>
    <script th:src="@{/assets/js/plugins/perfect-scrollbar.jquery.min.js}"></script>

    <!-- Chart JS -->
    <script th:src="@{/assets/js/plugins/chartjs.min.js}"></script>
    <!--  Notifications Plugin    -->
    <script th:src="@{/assets/js/plugins/bootstrap-notify.js}"></script>
    <!-- Control Center for Now Ui Dashboard: parallax effects, scripts for the example pages etc -->
    <script th:src="@{/assets/js/now-ui-dashboard.js?v=1.0.1}"></script>
    <!-- Now Ui Dashboard DEMO methods, don't include it in your project! -->
    <script th:src="@{/assets/demo/demo.js}"></script>
</div>


<!--底部footer-->
<footer class="footer" th:fragment="footer">
    <div class="container-fluid">
        <nav>
            <ul>
                <li>
                    <a href="#">
                        管理系统
                    </a>
                </li>
                <li>
                    <a href="#">
                        关于我们
                    </a>
                </li>
            </ul>
        </nav>
        <div class="copyright">
            &copy;
            <script>
                document.write(new Date().getFullYear())
            </script>,Coded by zy. <a href="#" target="_blank">联系我们</a>
        </div>
    </div>

    <!--Modal-->
    <!--Modal修改密码框-->
    <div class="modal fade p-3 mb-5 rounded" id="updatePasswordModal" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered" role="document">
            <div class="modal-content" style="margin-top: 15rem">
                <div class="modal-header">
                    <h5 class="modal-title">修改密码</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <!--注册表单-->
                    <form id="updatePassword_form">
                        <label>原密码</label>
                        <div class="form-group">
                            <input type="password" name="oldPwd" class="form-control" placeholder="原密码" >
                        </div>

                        <label>新密码</label>
                        <div class="form-group">
                            <input type="password" name="newPwd" class="form-control" placeholder="新密码">
                        </div>

                        <label>确认密码</label>
                        <div class="form-group">
                            <input type="password" name="checkPwd" class="form-control" placeholder="确认密码">
                        </div>

                        <div class="modal-footer">
                            <button type="button" class="btn btn-secondary" data-dismiss="modal">返回</button>
                            <input type="button" class="btn btn-primary" onclick="updatePassword()" value="修改">
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <script>
        function updatePassword(){
            var formData = $("#updatePassword_form").serialize();
            $.ajax({
                sync:false,
                url:'/account/updatePwd',
                data: formData,
                method:'post',
                dataType:'text',
                success:function(result){
                    if(result==='修改成功,请重新登录!'){
                        demo.showNotification('success',result);
                        setTimeout(function (){
                            window.location = '/logout'
                        },1000)
                        return;
                    }
                    demo.showNotification('danger',result);
                }
            })
        }
    </script>
</footer>

